<?php

namespace app\admin\validate;
//TODO:删除use示例
use app\common\model\Config as ConfigModel;

class Admin extends AdminBase
{

    // 验证规则
    protected $rule = [
        'username'      => 'require|unique:admin',
        'password'      => 'require|confirm|length:6,20',
        'email'         => 'require|email',
        'nickname'      => 'require',
        'mobile'        => 'unique:admin',
        'old_password'  => 'require',
    ];

    // 验证提示
    protected $message = [

        'username.require'      => '用户名不能为空',
        'username.unique'       => '用户名已存在',
        'nickname.require'      => '昵称不能为空',
        'password.require'      => '密码不能为空',
        'password.confirm'      => '两次密码不一致',
        'password.length'       => '密码长度为6-20字符',
        'email.require'         => '邮箱不能为空',
        'email.email'           => '邮箱格式不正确',
        'email.unique'          => '邮箱已存在',
        'mobile.unique'         => '手机号已存在',
        'old_password.require'  => '旧密码不能为空',
    ];

    // 应用场景
    protected $scene = [
        'edit'      =>  ['nickname','email'],
        'add'      =>  ['username','nickname','email','mobile','password'],
    ];


}